package at.jsug.topicvoting.gwt1.client.logic.controller;

import at.jsug.topicvoting.gwt1.client.App;
import at.jsug.topicvoting.gwt1.client.logic.IEventListener;
import at.jsug.topicvoting.gwt1.client.logic.event.SaveTopicEvent;
import at.jsug.topicvoting.gwt1.client.vo.Topic;

public class SaveTopicCommand implements IEventListener<SaveTopicEvent> {

	public void eventReceived(SaveTopicEvent event) {
		System.out.println("SaveTopicCommand.eventReceived(event="+event+")");
		
		final Topic newTopic = Topic.newNeedTopic(-1, event.getTitle(), 1, true);
		App.DATA_FACADE.saveOrUpdateTopic(newTopic);
		
		// TODO insert vote within transaction; but do that in data layer below
	}

}
